package com.ruoyi.canteen.mapper;

import java.util.List;
import com.ruoyi.canteen.domain.CanteenQrAddress;
import com.ruoyi.canteen.vo.CanteenQrAddrVo;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

/**
 * 扫码地址Mapper接口
 * 
 * @author zhangw
 * @date 2021-09-26
 */
public interface CanteenQrAddressMapper 
{
    /**
     * 查询扫码地址
     * 
     * @param id 扫码地址主键
     * @return 扫码地址
     */
    public CanteenQrAddress selectCanteenQrAddressById(Long id);

    /**
     * 查询扫码地址列表
     * 
     * @param canteenQrAddress 扫码地址
     * @return 扫码地址集合
     */
    public List<CanteenQrAddress> selectCanteenQrAddressList(CanteenQrAddress canteenQrAddress);

    /**
     * 新增扫码地址
     * 
     * @param canteenQrAddress 扫码地址
     * @return 结果
     */
    public int insertCanteenQrAddress(CanteenQrAddress canteenQrAddress);

    /**
     * 修改扫码地址
     * 
     * @param canteenQrAddress 扫码地址
     * @return 结果
     */
    public int updateCanteenQrAddress(CanteenQrAddress canteenQrAddress);

    /**
     * 删除扫码地址
     * 
     * @param id 扫码地址主键
     * @return 结果
     */
    public int deleteCanteenQrAddressById(Long id);

    /**
     * 批量删除扫码地址
     * 
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteCanteenQrAddressByIds(Long[] ids);

    /**
     * 查询-现场点餐桌号详情
     * @param id 扫码桌号ID
     * @return
     */
    @Select("SELECT id,scene_id,a.dept_id,bed_no,address,display_address,dept_name " +
            "FROM canteen_qr_address as a\n" +
            "left join sys_dept as d on a.dept_id = d.dept_id\n" +
            "where scene_id = 2")
    @Results({
            @Result(property = "id", column = "id"),
            @Result(property = "deptId", column = "dept_id"),
            @Result(property = "deptName", column = "dept_name"),
            @Result(property = "bedNo", column = "bed_no"),
            @Result(property = "address", column = "address"),
            @Result(property = "displayAddress", column = "display_address")
    })
    public CanteenQrAddrVo selectCanteenQrAddrDetailById(Long id);

}
